﻿using System;

public class Student : ICloneable, IComparable<Student>
{
    private string adress;
    private string course;
    private string email;
    private Faculty faculty;
    private string firstName;
    private string lastName;
    private string middleName;
    private string mobilePhone;
    private Speciality speciality;
    private int ssn;
    private University university;

    public static void Main()
    {
        Student s = new Student();
        s.faculty = Faculty.FDIBA;
        Student p = (Student) s.Clone();
        p.faculty = Faculty.Suiciders; 
        Console.WriteLine(s.faculty);
        Console.WriteLine(p.faculty);
    }

    public object Clone()
    {
        return this.MemberwiseClone();
    }

    public int CompareTo(Student other)
    {
        int result = this.firstName.CompareTo(other.firstName);
        if (result == 0)
        {
            result = this.middleName.CompareTo(other.middleName);
        }
        if (result == 0)
        {
            result = this.lastName.CompareTo(other.lastName);
        }
        if (result == 0)
        {
            result = this.ssn.CompareTo(other.ssn);
        }
        return result;
    }

    public bool Equals(Student value)
    {
        bool isEqual = true;
        if (!firstName.Equals(value.firstName))
        {
            isEqual = false;
        }
        if (!middleName.Equals(value.middleName))
        {
            isEqual = false;
        }
        if (!lastName.Equals(value.lastName))
        {
            isEqual = false;
        }
        if (!ssn.Equals(value.ssn))
        {
            isEqual = false;
        }
        return isEqual;
    }

    public override bool Equals(object obj)
    {
        Student temp = obj as Student;
        if (temp == null) return false;
        return this.Equals(temp);
    }

    public override int GetHashCode()
    {
        unchecked
        {
            int result = 17;
            result = result * 23 + ((firstName != null) ? this.firstName.GetHashCode() : 0);
            result = result * 23 + ((middleName != null) ? this.middleName.GetHashCode() : 0);
            result = result * 23 + ((lastName != null) ? this.lastName.GetHashCode() : 0);
            result = result * 23 + this.ssn.GetHashCode();
            result = result * 23 + ((adress != null) ? this.adress.GetHashCode() : 0);
            result = result * 23 + ((mobilePhone != null) ? this.mobilePhone.GetHashCode() : 0);
            result = result * 23 + ((email != null) ? this.email.GetHashCode() : 0);
            result = result * 23 + ((course != null) ? this.course.GetHashCode() : 0);
            result = result * 23 + this.speciality.GetHashCode();
            result = result * 23 + this.university.GetHashCode();
            result = result * 23 + this.faculty.GetHashCode();
            return result;
        }
    }

    public override string ToString()
    {
        return string.Format(
            "firstName: {0}, middleName: {1}, lastName: {2}, ssn: {3}, adress: {4}, mobilePhone: {5}, email: {6}, course: {7}, speciality: {8}, university: {9}, faculty: {10}",
            firstName,
            middleName,
            lastName,
            ssn,
            adress,
            mobilePhone,
            email,
            course,
            speciality,
            university,
            faculty);
    }

    public static bool operator !=(Student firstStudent, Student secondStudent)
    {
        bool areEqual = firstStudent.Equals(secondStudent);
        return !areEqual;
    }

    public static bool operator ==(Student firstStudent, Student secondStudent)
    {
        bool areEqual = firstStudent.Equals(secondStudent);
        return areEqual;
    }
}